/*
 *	This file is part of Lounge-Cast.
 *
 *  Author:  	Markus Moormann
 *	E-mail:  	mmoorman@uni-osnabrueck.de
 *	Copyright:	University of Osnabrueck (Zentrum Virtuos)
 * 	Website:	www.uni-osnabrueck.de
 *	Date:		16.02.2011
 *
 *	Lounge-Cast is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *	Lounge-Cast is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Lounge-Cast.  If not, see <http://www.gnu.org/licenses/>.
 */
package multimedia.view.renderer
{
	import multimedia.model.vo.MediaVO;
	
	import mx.controls.listClasses.ListData;
	import mx.controls.listClasses.ListItemRenderer;

	public class UserMediaRenderer extends ListItemRenderer
	{
		public function UserMediaRenderer()
		{
			super();
		}
		
		// Override the set method for the data property
		// to set the font color and style of each node.        
		override public function set data(value:Object):void
		{
			super.data = value;
			if (super.data && super.data is MediaVO && (super.data as MediaVO).approved)
			{
				setStyle("color", 0xc4c4c4);
				setStyle("fontWeight", 'bold');
			}
			else
			{
				setStyle("color", 0x000000);
				setStyle("fontWeight", 'normal');
			}
		}

		// Override the updateDisplayList() method 
		// to set the text for each tree node.      
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			if (super.data)
			{
				super.label.text = ListData(super.listData).label;
			}
		}
		
	}
}